package com.example.androiddemo;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

import com.ex.net.NetFragment;
import com.example.ui.base.BaseFragment;
import com.example.ui.base.BaseFragmentActivity;

public class MainActivity extends BaseFragmentActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		initClick();
		
		addFrg();
		
		//test
//		Collections.
	}
	
	private void addFrg() {
		getSupportFragmentManager()
			.beginTransaction()
			.replace(R.id.container, getFrg())
			.commitAllowingStateLoss();
	}
	
	private BaseFragment getFrg() {
		return new NetFragment();
	}
	
	private void initClick() {
		findViewById(R.id.jumpBtn).setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				FullScreenVideoActivity.startActivity(MainActivity.this);
			}
		});
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
		//关闭网络
		App.closeVolleyReq();
	}

}
